<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.

    You may not modify, use, reproduce, or distribute this software except in
    compliance with  the terms of the License at:
    http://java.net/projects/javaeetutorial/pages/BerkeleyLicense

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Books</title>
    </h:head>
    <h:body>
            <h2>
                Books Management
            </h2>
        <h:form id="frmBook">
            <h:dataTable value="#{bookBean.books}" var="book">
    			<h:column>
    				<f:facet name="header">Name</f:facet>
    				#{book.name}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Price</f:facet>
    				#{book.price}
    			</h:column>
 
    		</h:dataTable>
    		
    		<h:inputText id="name" value="#{bookBean.name}"/>
    		<h:inputText id="price" value="#{bookBean.price}"/>
    		
    		   <h:commandButton value="Save" actionListener="#{bookBean.saveBook}">
    		   		<f:ajax execute="name price" render="frmBook" />
    		   </h:commandButton>
    	</h:form>
    </h:body>
</html>